﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using NUnit.Framework;

namespace testing_thing
{
    public class Location : GameEntity
    {
        

        public Location(string[] ids)
            : base(ids, true)
        {
            AddIdentifier(new string[]{"location", "here"});
        }
        
        List<Path> _paths = new List<Path>();

        public void AddPath(Path pth)
        {
            _paths.Add(pth);
        }

        public Path AccessPath(string id)
        {
            foreach (Path pth in _paths)
            {
                if(pth.IdentifiedBy(id))
                {
                    return pth;
                }
            }
            return null;
        }

        public string PathList
        {
            get
            {
                string pathlist = "\n\nAnd you can go:\n\n";
                foreach (Path pth in _paths)
                    pathlist += pth.Title + "\n";
                return pathlist;
            }
        }


    }
    [TestFixture]
    public class LocationTests
    {
        [Test]
        public void LocateEntityTest()
        {
            Location loc = new Location(new string[] { "place" });
            Item pen = new Item(new string[] { "pen" }, false);
            Item bag = new Item(new string[] { "bag" }, true);
            pen.Title = "Pen";
            pen.Description = "This is a red pen";
            bag.Title = "Bag";
            bag.Description = "This is a brown leather bag that can contain stuff";
            bag.Inventory.AddItem(pen);
            loc.Inventory.AddItem(bag);
            Assert.AreSame(bag, loc.LocateEntity("bag"));
            Assert.AreSame(loc, loc.LocateEntity("place"));
            Assert.AreSame(loc, loc.LocateEntity("location"));
            Assert.IsNull(loc.LocateEntity("pen"));
        }
    }
}
